#include <stdio.h> 

int ca,cb,n; 
int opr[2][1000];
char com[6][10] = { "fill A", "fill B", "pour A B", "pour B A", "empty B",
          "empty A" };

int FromAtoB() {	
	int rstA=0, rstB=0, d =0;
	while (rstB!=n)
	{
		if(rstA==0)
		{
			rstA=ca;
			opr[0][d] = 0;// printf("fill A\n"); 
		}
		else if(rstB==cb)
		{
			rstB=0;
			opr[0][d] = 4; //printf ("empty B\n"); 
		}
		else if(rstA>(cb-rstB))
		{
			rstA-=(cb-rstB);
			rstB=cb;	
			opr[0][d] = 2; //printf("pour A B\n");
		}
		else
		{
			rstB+=rstA;
			rstA=0;	
			opr[0][d] = 2; //printf("pour A B\n");
		}	

		d++;
	}

	return d;
}

int FromBtoA() {
	int rstA=0, rstB=0, d =0;
	while (rstB!=n)
	{
		if(rstB==0)
		{
			rstB=cb;
			opr[1][d] = 1; //printf ("fill B\n"); 
		}
		else if(rstA==ca)
		{
			rstA=0;
			opr[1][d] = 5; //printf ("empty A\n"); 
		}
		else if(rstB>(ca-rstA))
		{
			rstB-=(ca-rstA);
			rstA=ca;
			opr[1][d] = 3;//printf("pour B A\n");
		}
		else
		{
			rstA+=rstB;
			rstB=0;
			opr[1][d] = 3;//printf("pour B A\n");
		}		

		d++;
	}

	return d;
}

int main(){ 
	int rs, dp[2];
	while (scanf("%d%d%d",&ca,&cb,&n) != EOF) 
	{ 	 
		if (cb==n)
		{
			printf ("fill B\n"); 
			printf ("success\n"); 
			continue;
		}
		if (ca==n)
		{
			printf ("fill A\n"); 
			printf ("pour A B\n");			
			printf ("success\n"); 
			continue;
		}

		dp[0] = FromAtoB();
		dp[1] = FromBtoA(); 
		if (dp[0] < dp[1] ) {	
			rs = 0;
		}
		else {
			rs = 1;	
		}

		for (int i = 0; i < dp[rs]; i++) {
			printf(com[opr[rs][i]]);
			printf("\n");
        }
        printf("success\n");
	}

	return 0; 
}
